#ifndef _TITLES_H_
#define _TITLES_H_
#include <gctypes.h>
#include <ogc/es.h>
#include "../../clibs/macros.h"
enum SYSTEM_TITLES_MINOR_TIDS {
    BOOT2_MINOR_TID=0x1,
    SYSTEM_MENU_MINOR_TID=0x2,
    FF4_IOS_MINOR_TID=0xf2,
    BOOTMII_IOS_MINOR_TID=0xfe,
    BC_MINOR_TID=0x100,
    MIOS_MINOR_TID=0x101
};
enum SYSTEM_TITLES_TID {
    BOOT2_TID=0x100000001,
    SYSTEM_MENU_TID=0x100000002,
    FF4_IOS_TID=0x1000000f2,
    BOOTMII_IOS_TID=0x1000000fe,
    BC_TID=0x100000100,
    MIOS_TID=0x100000101
};
enum TMD_DATAS {
    TMD_ISSUER_DATA=MAJOR_MINOR_NUMBER(0x40,0x0,u32),
	TMD_VERSION_DATA=MAJOR_MINOR_NUMBER(0x1,0x40,u32),
	TMD_CA_CRL_VERSION_DATA=MAJOR_MINOR_NUMBER(0x1,0x41,u32),
	TMD_SIGNER_CRL_VERSION_DATA=MAJOR_MINOR_NUMBER(0x1,0x42,u32),
	TMD_FILL2_DATA=MAJOR_MINOR_NUMBER(0x1,0x43,u32),
	TMD_SYS_VERSION_DATA=MAJOR_MINOR_NUMBER(0x8,0x44,u32),
	TMD_TITLE_ID_DATA=MAJOR_MINOR_NUMBER(0x8,0x4c,u32),
	TMD_TITLE_TYPE_DATA=MAJOR_MINOR_NUMBER(0x4,0x54,u32),
	TMD_GROUP_ID_DATA=MAJOR_MINOR_NUMBER(0x2,0x58,u32),
	TMD_ZERO_DATA=MAJOR_MINOR_NUMBER(0x2,0x5a,u32),
	TMD_REGION_DATA=MAJOR_MINOR_NUMBER(0x2,0x5c,u32),
	TMD_RATINGS_DATA=MAJOR_MINOR_NUMBER(0x10,0x5e,u32),
	TMD_RESERVED_DATA=MAJOR_MINOR_NUMBER(0xc,0x6e,u32),
	TMD_IPC_MASK_DATA=MAJOR_MINOR_NUMBER(0xc,0x7a,u32),
	TMD_RESERVED2_DATA=MAJOR_MINOR_NUMBER(0x12,0x86,u32),
	TMD_ACCESS_RIGHTS_DATA=MAJOR_MINOR_NUMBER(0x4,0x98,u32),
	TMD_TITLE_VERSION_DATA=MAJOR_MINOR_NUMBER(0x2,0x9c,u32),
	TMD_NUM_CONTENTS_DATA=MAJOR_MINOR_NUMBER(0x2,0x9e,u32),
	TMD_BOOT_INDEX_DATA=MAJOR_MINOR_NUMBER(0x2,0xa0,u32),
	TMD_FILL3_DATA=MAJOR_MINOR_NUMBER(0x2,0xa2,u32),
	TMD_CONTENTS_DATA=MAJOR_MINOR_NUMBER(0x24,0xa4,u32),
};
enum TMD_CONTENT_DATAS {
    TMD_CONTENT_ID_DATA=MAJOR_MINOR_NUMBER(0x4,0x0,u8),
	TMD_CONTENT_INDEX_DATA=MAJOR_MINOR_NUMBER(0x2,0x4,u8),
	TMD_CONTENT_TYPE_DATA=MAJOR_MINOR_NUMBER(0x2,0x6,u8),
	TMD_CONTENT_SIZE_DATA=MAJOR_MINOR_NUMBER(0x8,0x8,u8),
	TMD_CONTENT_HASH_DATA=MAJOR_MINOR_NUMBER(0x14,0x10,u8),
	TMD_CONTENT_DATA=MAJOR_MINOR_NUMBER(0x24,0x0,u8)
};
struct stTitleIdentificationModule {
    u16 intModuleIndex;
    u8 chModuleHash[20];
};
struct stTitleInfos {
    char *strTitleLabel;
    u64 intTitleId;
    struct stTitleIdentificationModule stIdentificationModule;
    char *strTitleInfos;
};
enum {
    TIKVIEW_STRUCTURE_SIZE=sizeof(tikview),
    TMD_CONTENT_STRUCTURE_SIZE=sizeof(tmd_content),
	TMD_STRUCTURE_SIZE=sizeof(tmd),
    TITLE_INFOS_STRUCTURE_SIZE=sizeof(struct stTitleInfos),
    TITLE_IDENTIFICATION_MODULE_STRUCTURE_SIZE=sizeof(struct stTitleIdentificationModule)
};
#define GET_CONTENT_ENUM_TMD_DATA(i,d) (MAJOR_MINOR_NUMBER(MAJOR_NUMBER((d),u8),TMD_STRUCTURE_SIZE+TMD_CONTENT_STRUCTURE_SIZE*(i)+MINOR_NUMBER((d),u8),u32))
#endif
